package com.bestcem.xm.ticket.service.manager.record.param;

import com.bestcem.xm.ticket.controller.param.ticket.InsertTicketParam;
import com.bestcem.xm.ticket.entity.mongo.Ticket;
import com.bestcem.xm.ticket.enums.*;
import com.bestcem.xm.ticket.service.manager.fsm.TicketFsmManager;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.util.LinkedHashMap;
import java.util.List;

/**
 * transfer方法参数类
 *
 * @author liheng
 * @version v1.0
 * SystemTicketRecordParam {@link SystemTicketRecordParam}
 * AuditedTicketRecordParam {@link AuditedTicketRecordParam}
 * SystemTicketRecordParam {@link SystemTicketRecordParam}
 * 三个参数类的合集
 * @date 2021/8/24 16:16
 * @see TicketFsmManager#transfer(Ticket, TicketEventEnum, TransferParam)
 */
@Data
public class TransferParam {

    /**
     * orgId
     */
    private String orgId;
    /**
     * roleId
     */
    @JsonProperty("role_id")
    private String roleId;
    /**
     * userId
     */
    private String userId;
    /**
     * userName
     */
    private String userName;
    /**
     * regionName
     */
    private String regionName;
    /**
     * ticketId
     */
    private String ticketId;
    /**
     * source
     */
    private Integer source;
    /**
     * title
     */
    private String title;
    /**
     * content
     */
    private String content;
    /**
     * status
     */
    private TicketStatusEnum status;
    /**
     * type; 原ttype
     */
    private TicketTypeEnum type;


    /**
     * followerInfo，跟进人详情，格式：{group_level.title}-{role.title}
     */
    private String followerInfo;

    /**
     * forbiddenPublish
     */
    private Boolean forbiddenPublish;


    /**
     * isAgreed
     */
    private Boolean isAgreed;

    /**
     * auditHandle
     */
    private Integer auditHandle;

    /**
     * timeLimit
     */
    private Integer timeLimit;

    /**
     * timeLimitType
     */
    private Integer timeLimitType;


    /**
     * timetype
     */
    private Integer timeType;

    /**
     * isCompleted
     */
    private Boolean isCompleted;
    /**
     * 自定义字段列表
     * 如果字段是 {@link TicketTemplateFieldTypeEnum#TEXT}, 这里就是 String;     例: 'field1' => 'test'
     * 如果是 {@link TicketTemplateFieldTypeEnum#SELECT}, 这里就是int转的String; 例: 'field3' => '1'
     */
    private LinkedHashMap<TicketTemplateFieldNameEnum, String> fieldMap;

    /**
     * 原因（转派/关闭/重新开启）
     */
    private String reason;

    /**
     * 部门大区
     */
    @JsonProperty(value = "region_id")
    private String regionId;

    /**
     * 用户过滤 0-按层级过滤，1-按用户过滤
     */
    private Integer followFilter;


    /**
     * 处理模板id
     */
    @JsonProperty(value = "template_id")
    private String templateId;

    /**
     * 处理模板答案
     */
    @JsonProperty(value = "template_fields")
    private List<InsertTicketParam.TemplateField> templateFields;


    /**
     * 执行转派的人的名称
     */
    @JsonIgnore
    private String dispatcher;

    /**
     * 执行转派的人的id
     */
    @JsonIgnore
    private String dispatcherId;

    /**
     * 用户过滤，0-按层级，1-按用户
     */
    private Integer userFilter;

}
